#ifndef EepromManage_VARIABLES
#define EepromManage_VARIABLES

#ifdef __cplusplus
extern "C" {
#endif

#include "stm32f4xx.h"

#define RET_OK		0
#define RET_ERROR	1


#define	EPERR_WAIT_TIME		20000

//128Kbit(16K bytes) EEPROM,Max address is 16384
#define PARA_ZONE_MAX			3800

#define ERROR_SAVE_ORDER		3950

#define ERROR_NUM_ADR			4092
#define ERROR_ZONE_ADR			4096		//64的整倍数

#define FIRST_ERROR_ZONE_ADR			12288		//64的整倍数

#define BOOT_LOG			0x2000			//8192
#define BOOT_VER			0x2100
#define DID_ADR			    0x2200

#define I2C_SLAVE_ADDR      0x50

#define MAX_ERROR_LOG		25
#define MUL_MAX_ERROR_LOG   (MAX_ERROR_LOG * 2)

#define MAX_ERR_NUMBER		32

#ifdef	EPROMMANAGE_H
	#define	EpExtern
#else
	#define EpExtern	extern
#endif


#ifdef EPROMMANAGE_H
EpExtern uint16 FlagShowErr=0,FlagClrErr=0;
EpExtern Uint16	SizeErrLog=0;
EpExtern Uint16	StClrErrLog=0;
EpExtern Uint16 StReadErrLog=0;
EpExtern Uint16 GetErrOrderNum=0;
EpExtern Uint16 ErrorNumber=0;
EpExtern Uint16 ErrLogStatus[MAX_ERROR_LOG]={0};
EpExtern Uint16 FlagUpdateErrorStatus=0;
EpExtern Uint16 gEEpromErrorFlag=0;
#else
EpExtern uint16 FlagShowErr,FlagClrErr;
EpExtern Uint16	SizeErrLog;
EpExtern Uint16	StClrErrLog;
EpExtern Uint16 StReadErrLog;
EpExtern Uint16 GetErrOrderNum;
EpExtern Uint16 ErrorNumber;
EpExtern Uint16 ErrLogStatus[MAX_ERROR_LOG];
EpExtern Uint16 FlagUpdateErrorStatus;
EpExtern Uint16 gEEpromErrorFlag;
#endif
EpExtern Uint16 ReadEeprom(Uint16 Address);
EpExtern void InitEeprom(void);
EpExtern int16_t WriteBootPara(uint16 value);
EpExtern  int16_t WriteBootPara(uint16 value);
#ifdef	EPROMMANAGE_H
Uint16 ReadEeprom(Uint16 Address);
Uint16 WriteEeprom(Uint16 Address,Uint16 WPara);

volatile uint16 wdata=0,rdata=0;
Uint16	FirstPowerFlag=0;
#endif


#ifdef __cplusplus
}
#endif /* extern "C" */

#endif    // end of TRIP_VARIABLES definition
